<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<link rel="stylesheet" type="text/css" href="../../../Themes/default/easyui.css">
		<link rel="stylesheet" type="text/css" href="../../../Themes/icon.css">
		<link rel="stylesheet" type="text/css" href="../../../CSS/demo.css">
		<link rel="stylesheet" type="text/css" href="../../../CSS/common.css">
		<script type="text/javascript" src="../../../JS/jquery.min.js"></script>
		<script type="text/javascript" src="../../../JS/jquery.easyui.min.js"></script>
		<script type="text/javascript" src="../../../JS/common.js"></script>
		<script type="text/javascript" src='../../../JS/SHA-1.js'></script>
		<script type="text/javascript" src='../../../JS/detailView.js'></script>
	</head>

	<body style="padding: 0px;">

		<div class="easyui-layout" style="width:100%;height:600px;">
			<div data-options="region:'center'">
				<div>
					<table id="dg" style="width:100%;height:400px" singleSelect="true" fitColumns="true">
					</table>
				</div>
			</div>
		</div>
		<div id="toolbar"></div>
	</body>
	<script type="text/javascript">
		var content; //保存明细按钮
		var auth = "admin;" + hex_sha1("admin1"); //定义授权信息
		var data = {
			"icon": "icon-redo",
			"func": "newdata()",
			"functionname": "生成销售结算"
		};
		content = "<a href=\"javascript:void(0)\" class=\"easyui-linkbutton\"  iconCls=\"" + data.icon + "\" plain='true' onclick=\"" + data.func + "\">" + data.functionname + "</a>";
		$('#toolbar').append(content);
		$('#dg').datagrid({
			url: RemoteLinkAddress + "/logistics/salesorder/list.do?STATE=出库完成",
			toolbar: '#toolbar',
			method: 'get',
			singleSelect: 'true',
			pagination: 'true',
			rownumbers: 'true',
			autoRowHeight: 'true',
			fitColumns: 'false',
			height: 400,
			columns: [
				[{
					field: 'ORDER_NO',
					title: '销售单编号',
					width: '18%',
					align: 'center'
				}, {
					field: 'CUSTOMER_TYPE',
					title: '用户组',
					width: '18%',
					align: 'center'
				}, {
					field: 'CUSTOMER_NAME',
					title: '配送单位',
					width: '20%',
					align: 'center'
				}, {
					field: 'DISTRIBUTION_DATE',
					title: '配送时间',
					width: '15%',
					align: 'center'
				}, {
					field: 'STATE',
					title: '订单状态',
					width: '20%',
					align: 'center'
				}, ]
			],
			onDblClickRow: function(index, row) {
				toWareHouseOutAdd();
			}
		})

		function newdata() {
			toWareHouseOutAdd();
		}

		function toWareHouseOutAdd() {
			var row = $("#dg").datagrid('getSelected');
			if(row) {
				var pLocation = "";
				pLocation = "UI/LOGISTICS/SalesSettlementOrderCreate/SalesSettlementOrderCreateAdd.html?id=" + row.ID;
				AddTabIn("生成销售结算明细", parent.parent.$("#tabs"), pLocation);
			} else {
				$.messager.alert("警告", "请选中数据");
			}
		}
	</script>

</html>